#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

int s = 0;
pthread_mutex_t lock;

void* myfunc(void* args){
	int i;
	pthread_mutex_lock(&lock);
	for(i=0;i<100000;i++){
		s++;
	}	
	pthread_mutex_unlock(&lock);
	return  NULL;
}
int main(){
	pthread_t th1;
	pthread_t th2;

	
	pthread_create(&th1,NULL,myfunc,NULL);
	pthread_create(&th2,NULL,myfunc,NULL);

	pthread_join(th1,NULL);
	pthread_join(th2,NULL);

//	int s1 = args1.result;
//	int s2 = args2.result;
//	printf("s1 = %d\n",s1);
//	printf("s2 = %d\n",s2);
	printf("s  = %d\n",s);
	return 0;

}

